package com.study.manage.dal;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.study.manage.domain.EvaluateApplyTeam;
import com.study.manage.domain.enumm.LiveDieState;

public interface EvaluateApplyTeamRepository
        extends PagingAndSortingRepository<EvaluateApplyTeam, Long> {

    List<EvaluateApplyTeam> findByEvaluateApplyIdAndState(Long evaluateApplyId, LiveDieState state);

    @Query("select t from EvaluateApplyTeam t,Orders o where t.id=o.extId and o.type=3"
            + " and t.state=0 and o.payState=0 and t.evaluateApplyId=:evaluateApplyId")
    Float sumMoneyByApplyId(@Param("evaluateApplyId") Long evaluateApplyId);

}
